#include <stdio.h>

int main()
{
    long int s,v,t,h,min;
    scanf("%ld %ld",&s,&v);
    t=s/v+10;
    if(s%v==0)
    {
        if(s/v<=480)
            {
                h=(480-t)/60;
                min=(480-t)%60;
                printf("%02d:%02d",h,min);
            }
        if(s/v>480 && s/v<=1440)
            {
                h=(1440-(t-480))/60;
                min=(1440-(t-480))%60;
                printf("%02d:%02d",h,min);
            }
        if(s/v>1440)
            {
                h=(2880-(t-1440-480))/60;
                min=(2880-(t-1440-480))%60;
                printf("%02d:%02d",h,min);
            }
    }
    else
    {
        if(s/v<=480)
            {
                h=(480-t)/60;
                min=(480-t)%60-1;
                printf("%02d:%02d",h,min);
            }
        if(s/v>480 && s/v<=1440)
            {
                h=(1440-(t-480))/60;
                min=(1440-(t-480))%60-1;
                printf("%02d:%02d",h,min);
            }
        if(s/v>1440)
            {
                h=(2880-(t-1440-480))/60;
                min=(2880-(t-1440-480))%60-1;
                printf("%02d:%02d",h,min);
            }
    }
    return 0;
}